<?php

declare(strict_types=1);

namespace app\model;

use think\Model;
use think\model\concern\SoftDelete;

class AuthRole extends Model
{
    use SoftDelete;

    protected $name = 'auth_role';

    protected $autoWriteTimestamp = 'datetime';

    public function permissions()
    {
        return $this->belongsToMany(AuthPermission::class, 'auth_role_perm', 'permission_id', 'role_id');
    }

    public function users()
    {
        return $this->belongsToMany(User::class, 'auth_user_role', 'user_id', 'role_id');
    }
}
